Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
How do I count the amount of reactions made on a specific emoji from a message that was sent? | discord.js v13

I'm trying to make a bot where a user makes a poll and if a certain emoji that the bot has reacted with reaches a number, say 10, then it does other actions. However, that is not my issue. My issue is collecting the amount of reactions itself from that emoji.

My Code:

    const embedSend = await message.channel.send({ embeds: [suggestionEmbed] }).then(async sEmbed => {
        await sEmbed.react('⬆️');
        await sEmbed.react('⬇️');
        const filter = (reaction, user) => {
            return ['⬆️', '⬇️'].includes(reaction.emoji.name) && user.id === message.author.id;
        };
        sEmbed.awaitReactions({ filter, max: 20, time: 50000, errors: ['time'] })
        .then(collected => {
            const reaction = collected.first();
            if (reaction.emoji.name === '⬆️') {
                console.log('up');
            } else if (reaction.emoji.name === '⬇️') {
                console.log('down');

            }
        })
        .catch(collected => {
           console.log("didnt reach 20 reacts");
        });
    });

I tried using the previous method above. However, it doesn't seem to actually print up or down for every reaction after reaching 20 reacts but instead it prints nothing or just up or just down. I've tried using the line of code below to count the emojis but no luck either:

  console.log(sEmbed.reactions.find(reaction => reaction.emoji.name === '⬆️').count)

Placed this inside of the .then statement with the awaitReactions right under the If-else block of code and got no output.

 embedSend.reactions.cache.get('⬆️').count;

This I've placed after the embedSend and it returns me this error:

TypeError: Cannot read property 'reactions' of undefined

and if i place it within the block of code tiehr the embedSend or awaitReactions and change it to sEmbed it returns nothing.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda